/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2021-12-22
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
#ifndef _LS_BLE_FILE_OTA_API_H_
#define _LS_BLE_FILE_OTA_API_H_

/*----------------------------Head file----------------------------*/
#include "stdint.h"
#include "ls_ble_file_api.h"
#include "ls_ble_sdk_config.h"

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/
#pragma pack(1)

typedef enum {
    OTA_INFO_SUCCESS = 0,
    OTA_INFO_TYPE_ERROR,
    OTA_INFO_SIZE_ERROR,
    OTA_INFO_DEV_BUSY,
    OTA_INFO_DEV_TYPE_ERR,
    OTA_INFO_PROJ_NUM_ERR,
} ota_rsp_err_t;


typedef enum {
    OTA_FILE_TYPE_APP = 0,
    OTA_FILE_TYPE_BLT,
} ota_file_type_t;


typedef struct {
    uint8_t file_type;
    uint32_t file_len;
    uint16_t dev_type;
    uint16_t project_num;
    uint16_t version;
    uint16_t file_crc16;
    uint16_t prnn;
} ota_info_t;

#pragma pack()

/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/
extern uint8_t ls_ble_file_set_ota_info(uint8_t *payload, uint16_t payload_len, file_trans_t* file_trans);
extern bool ls_ble_file_ota_rx_raw_data_handle(uint8_t *file_data, uint16_t data_len, file_trans_t* file_trans);
extern uint8_t ls_ble_file_ota_trans_done_handle(file_trans_t* file_trans);

/*-----------------------------------------------------------------*/

#endif
